﻿namespace CodeSmackdown.Web.Models
{
    using System.Linq;
    using System.Collections.Generic;

    public class UserAccountModel
    {
        public User User
        {
            get;
            private set;
        }

        public List<Snippet> SubmittedSnippets
        {
            get;
            private set;
        }

        public List<Comment> SubmittedComments
        {
            get;
            private set;
        }

        public int VoteCount
        {
            get;
            private set;
        }

        public UserAccountModel(User user)
        {
            this.User = user;

            CodeSmackdownDataContext ctx = new CodeSmackdownDataContext();
            this.VoteCount = ctx.GetVoteCount(user);
            this.SubmittedSnippets = ctx.GetSubmittedSnippets(user);
            this.SubmittedComments = ctx.GetSubmittedComments(user);
        }
    }
}
